// **************************************************************
// Com ++ Framework by the C++ World
// Please report defects: mailto:compp@cplusplusworld.com
// Please visit: http://www.cplusplusworld.com/socketlibrary.html
// **************************************************************

#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

#include "ComPlusPlus/ComPlusPlus"

int main( int argc, char * argv [] ) {

  if ( argc != 2 ) {
    std::cout << "usage: ExampleDirEnt Filename\n";
    exit (1);
  }

  try {
    if ( ! compp::DirEntry::Exist ( argv [1] ) ) {
      std::cout << argv [1] << " does not exist.\n";
      exit ( 1 );
    }

    compp::DirEntry Entry ( argv [ 1 ] ); 
    
    std::cout << "Entry.getName " << Entry.getName () << "\n";
    std::cout << "Entry.isDirectory " << Entry.isDirectory () << "\n"; 
    std::cout << "Entry.isRegularFile " << Entry.isRegularFile () << "\n";
    std::cout << "Entry.isCharDevice " << Entry.isCharDevice () << "\n";
    std::cout << "Entry.isBlockDevice " << Entry.isBlockDevice () << "\n";
    std::cout << "Entry.isFIFO " << Entry.isFIFO () << "\n";
    std::cout << "Entry.isSocket " << Entry.isSocket () << "\n";	
    std::cout << "Entry.isSymLink " << Entry.isSymLink () << "\n";      
    std::cout << "Entry.getInode " << Entry.getInode () << "\n";	
    std::cout << "Entry.getAccessTime " << Entry.getAccessTime() << "\n";
    std::cout << "Entry.getChangeTime " << Entry.getChangeTime() << "\n";
    std::cout << "Entry.getLastModificationTime " << Entry.getLastModificationTime() << "\n";
    std::cout << "Entry.getSize " << Entry.getSize() << "\n";
    std::cout << "Entry.getUid " << Entry.getUid() << "\n";
    std::cout << "Entry.getGid " << Entry.getGid() << "\n";
    std::cout << "Entry.getNumLinks " << Entry.getNumLinks() << "\n";

  } catch ( syspp::ComException & e ) {
    std::cout << "Exception " << e.what() << "\n";    
  }  
    
  return 0;
}
